<template>
  <view class="reformCard" @click="toAffairDetail">
    <view class="cardItem top">
      <view class="name"
        >{{ msg.buildingName + "-" + msg.elevatorAddress }}
        <text class="tag">事务</text>
      </view>
      <!-- <view class="status">{{ msg.status }}</view> -->
    </view>
    <view class="cardItem">
      <view class="label">工单类型:</view>
      <view class="desc">事务工单</view>
    </view>
    <view class="cardItem">
      <view class="label">任务描述:</view>
      <view class="desc">{{ planDesc }}</view>
    </view>
    <view class="cardItem">
      <view class="label">执行人:</view>
      <view class="desc">{{ msg.userNames||'-' }}</view>
    </view>
    <view class="cardItem">
      <view class="label">状态:</view>
      <view
        class="statusTag"
        :style="{
          color: stautsMap[msg.status].color,
          borderColor: stautsMap[msg.status].color,
        }"
        >{{ stautsMap[msg.status].text }}</view
      >
    </view>
  </view>
</template>

<script>
export default {
	props: {
		msg: {
			type: Object,
		},
	},
	computed:{
		planDesc() {
			if (this.msg.planDesc) {
				return this.msg.planDesc.split(' &gt; ').join('>');
			} else {
				return '';
			}
		},
	},
	data() {
		return {
			stautsMap: {
				1: {
					text: '待指派',
					color: '#FA6400',
				},
				2: {
					text: '待开始',
					color: '#0091ff',
				},
				3: {
					text: '进行中',
					color: '#0091ff',
				},
				4: {
					text: '已完成',
					color: '#999',
				},
				5: {
					text: '已关闭',
					color: '#999',
				},
			},
		};
	},
	methods: {
		toAffairDetail() {
			uni.navigateTo({
				url:
          '/subpages/repair/affair/affairDetail?planId=' +
          this.msg.planId +
          '&elevatorId=' +
          this.msg.elevatorId,
			});
		},
	},
};
</script>

<style lang="scss" scoped>
@import "./card.scss";
</style>
